package com.ruoyi.web.controller.gift;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.gift.domain.dto.StatsQueryDTO;
import com.ruoyi.gift.domain.vo.MaintenanceStatsVO;
import com.ruoyi.gift.domain.vo.StatsResultVO;
import com.ruoyi.gift.service.IRoadSignStatsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 统计分析
 */
@RestController
@RequestMapping("/system/stats")
public class StatsController extends BaseController {

    @Autowired
    private IRoadSignStatsService roadSignStatsService;

    /**
     * 路牌数量统计
     */
    @PostMapping("/roadSignCount")
    public AjaxResult roadSignCount(@RequestBody StatsQueryDTO queryDTO) {
        List<StatsResultVO> result = roadSignStatsService.getRoadSignCountStats(queryDTO);
        return success(result);
    }

    /**
     * 维修情况统计列表
     */
    @GetMapping("/maintenanceList")
    public TableDataInfo maintenanceList(StatsQueryDTO queryDTO) {
        startPage();
        List<MaintenanceStatsVO> list = roadSignStatsService.getMaintenanceStats(queryDTO);
        return getDataTable(list);
    }

    /**
     * 维修情况汇总统计
     */
    @GetMapping("/maintenanceSummary")
    public AjaxResult maintenanceSummary(StatsQueryDTO queryDTO) {
        return success(roadSignStatsService.getMaintenanceSummary(queryDTO));
    }
}